export function mapChartFun(cityname, datamap, zommN, mapdata) {
	let mapOption = {
		tooltip: {
			trigger: 'item',
			triggerOn: 'none',
			backgroundColor: '#1D403B', // 背景色
			borderColor: 'rgba(139,209,182,0.38)', // 边框颜色
			borderWidth: 1, // 边框宽度
			padding: 10, // 内边距
			textStyle: {
			color: '#fff', // 文字颜色
			fontSize: 12, // 文字大小
			fontWeight: 'normal' // 文字粗细
			},
			formatter: function(params) {
				let searchIn
				mapdata.forEach(element => {
					if (element.name == params.name) {searchIn = element; }
				});
				let str = `
					<div style="font-size:14px">${searchIn.name}</div>
							<div style="font-size:14px">基地总数：${searchIn.baseCnt}</div>
							<div style="font-size:14px">大棚总数：${searchIn.greenhouseCnt}</div>
							<div style="font-size:14px;margin-bottom:8px">设备总数：${searchIn.deviceTotal}</div>
							
				`
				for (let i = 0; i < searchIn.deviceMaps.length; i++) {
					str+=`<div>${searchIn.deviceMaps[i].name}：${searchIn.deviceMaps[i].cnt}</div>`
				}
				return str;
			}
		},
		geo: [{
				map: cityname,
				aspectScale: 1,
				zoom: zommN,
				layoutCenter: ["50%", "52%"],
				layoutSize: "180%",
				show: true,
				roam: false,
				label: {
					emphasis: {
						show: false,
					},
				},
				itemStyle: {
					normal: {
						borderColor: "#59CDF5",
						borderWidth: 2,
						shadowColor: "#016630",
						shadowOffsetY: 10,
						shadowBlur: 120,
						areaColor: "transparent",
					},
				}
			},
			// 重影
			{
				type: "map",
				map: cityname,
				zlevel: -1,
				aspectScale: 1,
				zoom: zommN,
				layoutCenter: ["50%", "53%"],
				layoutSize: "180%",
				roam: false,
				silent: true,
				itemStyle: {
					normal: {
						borderWidth: 1,
						// borderColor:"rgba(17, 149, 216,0.6)",
						borderColor: "#016630",
						shadowColor: "rgba(172, 122, 255,0.5)",
						shadowOffsetY: 5,
						shadowBlur: 15,
						areaColor: "#038C47",
					},
				},
			},
			{
				type: "map",
				map: cityname,
				zlevel: -2,
				aspectScale: 1,
				zoom: zommN,
				layoutCenter: ["50%", "54%"],
				layoutSize: "180%",
				roam: false,
				silent: true,
				itemStyle: {
					normal: {
						borderWidth: 1,
						// borderColor: "rgba(57, 132, 188,0.4)",
						borderColor: "#016630",
						shadowColor: "#038F49",
						shadowOffsetY: 5,
						shadowBlur: 15,
						areaColor: "transpercent",
					},
				},
			}
		],
		series: [{
				name: "沙坡头区数据",
				type: "map",
				map: cityname, // 自定义扩展图表类型
				aspectScale: 1,
				zoom: zommN, // 缩放
				showLegendSymbol: true,
				label: {
					normal: {
						show: true,
						textStyle: {
							color: "#fff",
							fontSize: "120%"
						},
					},
					emphasis: {
						// show: false,
					},
				},
				itemStyle: {
					normal: {
						areaColor: {
							type: "linear",
							x: 1200,
							y: 0,
							x2: 0,
							y2: 0,
							colorStops: [{
									offset: 0,
									color: "#12AFB8", // 0% 处的颜色
								},
								{
									offset: 0.3,
									color: "#099A92", // 50% 处的颜色
								},
								{
									offset: 0.8,
									color: "#16B5C3", // 50% 处的颜色
								},
								{
									offset: 1,
									color: "#0A9F98", // 50% 处的颜色
								},
							],
							global: true, // 缺省为 false
						},
						borderColor: "#59F0FD",
						borderWidth: 0.2,
					},
					emphasis: {
						show: false,
						color: "#fff",
						areaColor: {
							type: "linear",
							x: 1200,
							y: 0,
							x2: 0,
							y2: 0,
							colorStops: [{
									offset: 0,
									color: "rgba(153, 255, 166, 1)", // 0% 处的颜色
								},
								{
									offset: 0.3,
									color: "rgba(153, 255, 166, 1)", // 50% 处的颜色
								},
								{
									offset: 0.8,
									color: "rgba(153, 255, 166, 1)", // 50% 处的颜色
								},
								{
									offset: 1,
									color: "rgba(153, 255, 166, 1)", // 50% 处的颜色
								},
							],
							global: true, // 缺省为 false
						},
					},
				},
				layoutCenter: ["50%", "52%"],
				layoutSize: "180%",
				markPoint: {
					symbol: "none",
				},
				data: datamap,
			},
		],
	};
	return mapOption

}
